package com.study.leetcode;

public class Solution_326 {
    public static boolean isPowerOfThree(int n) {
        if (n == 0) {
            return false;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        return n == 1;
    }

    public static void main(String[] args) {
        boolean powerOfThree = isPowerOfThree(-1);
        System.out.println("powerOfThree = " + powerOfThree);
    }
}
